package org.jerrymouse.jsa4j.vfs.local;

import java.util.HashMap;
import java.util.Map;

import org.jerrymouse.jsa4j.vfs.FileSystemManager;
import org.jerrymouse.jsa4j.vfs.VFS;

public class LocalVFS implements VFS {
	private Map<String, String> properties = new HashMap<String, String>();

	@Override
	public FileSystemManager getManager() {
		LocalFileSystemManager fileSystemManager = new LocalFileSystemManager();
		fileSystemManager.setBasePath(getBasePath());
		return fileSystemManager;
	}

	@Override
	public void setProperties(Map<String, String> properties) {
		this.properties = properties;
	}

	private String getBasePath() {
		if (properties.get("basePath") == null) {
			properties.put("basePath", System.getProperty("user.home")
					+ "/.jsa4j/vfs");
		}
		return properties.get("basePath");
	}

}
